<template>
  <div class="app-container">

	<!-- 列表 -->
    <el-table
      v-loading="listLoading"
      :data="list"
      stripe
      border
      style="width: 100%;margin-top: 10px;">

      <el-table-column
        label="序号"
        width="70"
        align="center">
        <template slot-scope="scope">
          {{ (pageNum - 1) * pageSize + scope.$index + 1 }}
        </template>
      </el-table-column>

      <el-table-column prop="id" label="ID" width="180"/>
      <el-table-column prop="taskDefinitionKey" label="KEY" />
      <el-table-column prop="name" label="流程名称" />
      <el-table-column prop="processInstanceId" label="实例ID" />
      <el-table-column prop="createTime" label="创建时间" />
      <el-table-column prop="startTime" label="开始时间" />
      <el-table-column prop="assignee" label="办理人" />
    </el-table>

    <!-- 分页组件 -->
    <el-pagination
      background
      :current-page="pageNum"
      :total="total"
      :page-size="pageSize"
      style="padding: 30px 0; text-align: right;"
      layout="total, prev, pager, next, jumper"
      @current-change="fetchData"
    />

  </div>
</template>
<script>
import api from '@/api/act/history'

export default {
  data() {
    return {
      listLoading: false, // 数据是否正在加载
      list: null, // 列表
      total: 0, // 数据库中的总记录数
      pageNum: 1,
      pageSize: 10,
      searchObj: {} // 查询表单对象

    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData(pageNum = 1) {
      this.pageNum = pageNum
      api.getPageList(this.pageNum, this.pageSize).then(response => {
        this.list = response.data.listMap
        this.total = response.data.total
      })
    }

  }
}
</script>
